<?php 
   echo $this->Html->script('jquery');
   $this->Paginator->options(array(
      'update' => '#content',
      'before' => $this->Js->get("#loader")->effect('fadeIn', array('buffer' => false)),
      'complete' => $this->Js->get("#loader")->effect('fadeOut', array('buffer' => false)),
   )); 
?>
<?php echo $this->Html->image('loader.gif', array('class' => 'hide', 'id' => 'loader')); ?>
<table cellspacing="0" cellpadding="0">
    <?php
         $tableHeaders = $this->Html->tableHeaders(array(
            $this->Paginator->sort('username', 'Nome de usuario'),
            $this->Paginator->sort('name', 'Nome'),
            $this->Paginator->sort('email'),
            $this->Paginator->sort('twitter')
         ));
         echo $tableHeaders;
         $rows = array();
         foreach($users as $user){
            $rows[] = array(
               $user['User']['username'],
               $user['User']['name'],
               $user['User']['email'],
               $user['User']['twitter'],
            );
         }
         
         echo $this->Html->tableCells($rows);
         echo $tableHeaders;
     ?>
</table>
<div class="paging">
   <?php
      echo $this->Paginator->prev('Prev', null, null, array('class' => 'disable'));
	  echo $this->Paginator->numbers();
      echo $this->Paginator->next('Next', null, null, array('class' => 'disable'));
    ?>
</div>
<?php echo $this->Js->writeBuffer(); ?>